import {getData} from '@/services/global';

const dataModel = {
  namespace: 'globalStore',

  state: {
    count: 1,
  },

  effects: {
    *getData({payload}, {call, put}) {
      return yield call(getData, {...payload});
    },

    *addCount(_, {call, put}) {
      yield put({
        type: 'setCount',
      });
    },
  },

  reducers: {
    setCount(state) {
      return {
        ...state,
        count: (state.count += 1),
      };
    },
  },
};

export default dataModel;
